home *** CD-ROM | disk | FTP | other *** search
- #!/usr/local/bin/perl
- #
- #
- # MH scan those messages whose message numbers end in the digits given
- # on the command line.
- # Usage: sscan [+folder] N ...
- # Where N is a single digit
- #
-
- $FORM="/homes/troubmh/Mail/stat.form";
- ##
- # Set the folder
- #
- if ( $ARGV[0] =~ /^\+/ )
- {
- $FOLDER = substr($ARGV[0],1);
- shift;
- } else
- {
- if ( $ENV{'FOLDER'} eq '' )
- {
- $FOLDER = `folder -fast`;
- chop $FOLDER;
- }
- else
- {
- $FOLDER = $ENV{'FOLDER'};
- }
- }
-
- ##
- # get the digits
- #
-
- if ( $#ARGV < 0 || $ARGV[0] eq '-help' || $ARGV[0] > 9 || $ARGV[0] < 0 )
- {
- print "Usage: $0 [+folder] digit_list\ndigit_list is space delimited\n";
- exit 1;
- }
-
- $first = `pick +$FOLDER first`;
- $last = `pick +$FOLDER last`;
- $dir = `mhpath +$FOLDER`; chop $dir;
-
- $digits = join('',@ARGV);
-
- for ( $first .. $last )
- {
- push(@msglist,$_) if ( $_ =~ /[$digits]$/ && -s "$dir/$_" );
- }
-
- exec 'scan', "+$FOLDER", '-form', $FORM, @msglist;
-